<?php

namespace App\Http\Controllers\Admin\System;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\System\Config;

class ConfigController extends Controller
{
    public function __construct()
    {
        view()->share([
            '_system' => 'am-in',
            '_config' => 'am-active'
        ]);
    }

    /**
     * 系统设置首页
     */
    public function index()
    {
        $config = Config::find(1);
        return view('admin.system.config.index', compact('config'));
    }

    /**
     * 更新系统设置
     */
    public function update(Request $request)
    {
        $config = Config::find(1);
        $config->update($request->all());
        return back()->with('success', '系统设置编辑成功！！');
    }

}
